package _10_3;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Scanner;

public class Main {
	public static Date inputDate(Scanner scn, SimpleDateFormat sdf, String msg) {
		System.out.print(msg + ": ");

		try {
			return sdf.parse(scn.next());
		} catch (ParseException e) {
			e.printStackTrace();
			System.exit(1);
		}

		return null;
	}

	public static void main(String[] args) {
		Locale locale = new Locale("bg", "BG");
		Scanner scn = new Scanner(System.in);
		SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy", locale);
		String[] tmp;
		int[] firstDate;
		int[] secondDate;

		tmp = sdf.format(inputDate(scn, sdf, "First date")).split("\\.");
		firstDate = new int[tmp.length];
		parseDate(tmp, firstDate);

		tmp = sdf.format(inputDate(scn, sdf, "Second date")).split("\\.");
		secondDate = new int[tmp.length];
		parseDate(tmp, secondDate);

		for (Integer i : firstDate) {
			System.out.println(i);
		}
	}

	public static void parseDate(String[] in, int[] out) {
		try {
			for (int i = 0; i < in.length; i++) {
				out[i] = Integer.parseInt(in[i]);
			}
		} catch (NumberFormatException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
